<?php include_once("header.html")?>
<script src="<?php echo $www_site_url?>/public/js/calendar.js" type="text/javascript"></script>
<div id="append"></div>
<div id="wrap">  <br />

<?php include_once("hometotal_left.html")?>

<div class="admincontent">
<div id="tabsD" style="width:100%">
  <ul>
	<li <?php if($type=='summary') echo 'class="on"';?>><a href="/client.php/hometotal/stores/summary"><span><?php echo lang("summary")?></span></a></li>
    <li <?php if($type=='yesorno') echo 'class="on"';?>><a href="/client.php/hometotal/stores/yesorno"><span><?php echo lang("yesorno")?></span></a></li>
    <li <?php if($type=='vote') echo 'class="on"';?>><a href="/client.php/hometotal/stores/vote"><span><?php echo lang("vote")?></span></a></li>
    <li <?php if($type=='time') echo 'class="on"';?>><a href="/client.php/hometotal/stores/time"><span><?php echo lang("score")?></span></a></li>

    <li style="float:right;"><?php echo lang("select_brand")?>:<input name="selbrand" type="text" class="ClocationInput" onclick="showmitibrands();" id="selbrand" value="<?php if(isset($brand) && $brand){ echo splitx($brand['b_name']); }?>" /></li>
  </ul>
</div>

<div id="brandlist" style="width: 170px; border: 1px solid #B5CFD9; background:#fefefe;display:none; position:absolute;z-index:999;">
  <ul>
  <?php
       if(isset($brands) && is_array($brands)){
         foreach ($brands as $b){
                ?>
	<li style="padding:2px;"> <label><a href="/client.php?action=hometotal&view=stores&selbrands=<?php echo $b['b_id']?>"><?php echo splitx($b['b_name']);?></a></label></li>
	  <?php
			}
      }
       ?>
     </ul>
</div>

<form action="/client.php" method="GET"  name="seachfrm">
 <input name="action" type="hidden" value="hometotal"  />
 <input name="view" type="hidden" value="stores"  />
 <input name="stores" type="hidden" value="<?php echo $type?>"  />
 <input name="cs_id" type="hidden" id="cs_id" value="<?php echo $cs_id;?>" />

<div id="storelist" style="width: 210px; border: 1px solid #B5CFD9; background:#fefefe;display:none; position:absolute;z-index:150;">
  <ul>
  <?php
       if(isset($stores) && is_array($stores)){
         foreach ($stores as $s){
                ?>
	<li style="padding:2px;"><a onclick="selectstore('<?php echo $s['cs_id']."|".splitx($s['cs_name']);?>');return false;" href="#"><?php echo splitx(stripslashes($s['cs_name']));?></a></li>
	  <?php
			}
      }
       ?>
     </ul>
</div>
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0" class="clear">
  <tr>
    <td class="CsearchLeft">&nbsp;</td>
    <td align="center" class="CsearchCenter">

     <?php echo lang("select_location")?>:<input name="selstore" type="text" class="ClocationInput" onclick="showstores();" id="selstore" value="<?php if(empty($selstore)) echo "--"; else echo $selstore;?>" />

     <?php echo lang("a_sdate")?>：
      <input name="sdate" type="text" class="CtimeInput" id="sdate" value="<?php echo $sdate;?>" onclick="showcalendar();"/>
      <?php echo lang("a_edate")?>：
      <input name="edate" type="text" class="CtimeInput" id="edate" value="<?php echo $edate;?>" onclick="showcalendar();" />
      <input name="button" type="submit" class="btnblue" id="button" value="<?php echo lang("search_report")?>" /></td>
    <td class="CsearchRight">&nbsp;</td>

  </tr>
</table>
</form>
<br />
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div class="table2TitleBg">
      <div class="table2TitleBg2">
            <div style="float:right;margin-right:10px;">
      <a href="javascript:exportImage();"><img src="<?php echo $www_site_url?>/public/images/export_image-icon.gif" border="0" title="export Image"></a>
      <a href="javascript:print();"><img src="<?php echo $www_site_url?>/public/images/print_icon.jpg" border="0" title="Print"></a>
      </div>
      	<div class="table2Title"><div class="table2TitleLeft"><span><?php echo lang("graphical_chart")?></span></div></div>
      </div>

    </div></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="table2LeftBorder"></td>
        <td><p align="center">
        <div id="flashcontent">
		<strong>You need to upgrade your Flash Player</strong>
	</div>
<?php if($type=='time'){?>
        <script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("<?php echo $www_site_url?>/public/flash/amline.swf", "amline", "100%", "400px", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addVariable("path", "<?php echo $www_site_url?>/public/flash/");
		so.addVariable("chart_id", "amline");
		so.addVariable("settings_file", encodeURIComponent("<?php echo $www_site_url?>/public/flash/amline_settings2.xml?102"));
		so.addVariable("data_file", encodeURIComponent("<?php echo $www_site_url?>/admin.php?action=chart&view=storetimedata&scoretype=<?php echo $type;?>&cs_id=<?php echo $cs_id;?>&sdate=<?php echo $sdate;?>&edate=<?php echo $edate;?>"));
		so.addVariable("preloader_color", "#ffffff");
		so.addVariable("additional_chart_settings", encodeURIComponent("<settings><labels><label lid='0'><text><![CDATA[<b><?php echo $chart_title?></b>]]></text></label></labels></settings>"));

		so.write("flashcontent");
		// ]]>
	</script>
     <?php
}else {?>
<script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("<?php echo $www_site_url?>/public/flash/amline.swf", "amline", "100%", "400px", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addVariable("path", "<?php echo $www_site_url?>/public/flash/");
		so.addVariable("chart_id", "amline");
		so.addVariable("settings_file", encodeURIComponent("<?php echo $www_site_url?>/public/flash/amline_settingstotal.xml?102"));
		so.addVariable("data_file", encodeURIComponent("<?php echo $www_site_url?>/admin.php?action=charttotal&view=storedata&scoretype=<?php echo $type;?>&cs_id=<?php echo $cs_id;?>&sdate=<?php echo $sdate;?>&edate=<?php echo $edate;?>"));
		so.addVariable("preloader_color", "#ffffff");
		so.addVariable("additional_chart_settings", encodeURIComponent("<settings><labels><label lid='0'><text><![CDATA[<b><?php echo $chart_title?></b>]]></text></label></labels><graphs><graph gid='0'><title><?php echo lang("environment")?></title></graph><graph gid='1'><title><?php echo lang("service")?></title></graph><graph gid='2'><title><?php echo lang("product")?></title></graph></graphs></settings>"));

		so.write("flashcontent");
		// ]]>
	</script>
    <?php
}?>
        </p>
              <p>&nbsp;</p>
          <p>&nbsp;</p>
<script>
function print(){
  document.getElementById("amline").printAsBitmap();
}
function exportImage() {
  document.getElementById("amline").exportImage('/plugins/export.php');
}

</script>
<div style="float:right;margin-right:10px;">
      <a href="javascript:printpage(1);"><img src="<?php echo $www_site_url?>/public/images/print_icon.jpg" border="0" title="Print"></a>
      </div>
<!--startprint1-->
<?php if($type=='time'){?>
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="CinitData">
                <tr>
                  <td colspan="5" class="title"><?php echo lang("original_figures")?></td>
                </tr>
                 <tr>
                  <td><?php echo lang("an_date")?></td>
                  <td><?php echo lang("assignment")?></td>
                  <?php
                  if(is_array($questions)){
		foreach ($questions as $k=>$ques){

			?>
                  <td><?php echo "Q".($k+1)?> <?php echo lang("an_date")?></td>
                 <?php }
                  }?>
                </tr>
                <?php
                if(isset($assignments)){
                	foreach ($assignments as $v){
                		?>
                <tr>
                  <td width="15%"><?php echo $v['day']?></td>
                  <td width="40%"><a href="<?php echo $www_site_url?>/client.php/hometotal/reportcomplete/re_id/<?php echo $v['re_id']?>/a_id/<?php echo $v['a_id']?>" target="_blank"><?php echo stripslashes($v['a_title'])?></a></td>
                  <?php if(isset($v['times']) && is_array( $v['times'])){
                  	foreach ( $v['times'] as $t){
                  		?>

                  <td width="15%"><?php echo $t?></td>
					<?php
                  	}
                  }
                  	?>
                </tr>
                <?php
                	}
                }
                ?>

              </table>
     <?php
}else {?>
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="CinitData">
                <tr>
                  <td colspan="5" class="title"><?php echo lang("original_figures")?></td>
                </tr>
                <tr>
                 <td><?php echo lang("an_date")?></td>
                  <td><?php echo lang("assignment")?></td>
                  <td><?php echo lang("service")?></td>
                  <td><?php echo lang("environment")?></td>
                  <td><?php echo lang("product")?></td>
                </tr>
                <?php
                if(isset($assignments) && is_array($assignments)){
                	foreach ($assignments as $v){

                ?>


                <tr>
                   <td width="15%"><?php echo $v['day']?></td>
                  <td width="40%"><a href="<?php echo $www_site_url?>/client.php/hometotal/reportcomplete/re_id/<?php echo $v['re_id']?>/a_id/<?php echo $v['a_id']?>" target="_blank"><?php echo splitx(stripslashes($v['a_title']))?></a></td>
                  <td width="15%"><?php echo $v['service']?></td>
                  <td width="15%"><?php echo $v['environment']?></td>
                  <td width="15%"><?php echo $v['product']?></td>
                </tr>
                <?php
                	}
                }
                ?>
              </table>
     <?php
               }

                ?>
<!--endprint1-->
                      <p>&nbsp;</p></td>
        <td class="table2RightBorder"></td>
      </tr>

      <tr>
        <td class="table2BottomLeft"></td>
        <td class="table2Bottom"></td>
        <td class="table2BottomRight"></td>
      </tr>
    </table></td>
  </tr>
</table>
</div>
</div>

</div>
<?php include_once("footer.html")?>
